package system

import (
	"gin-sns/app/ginframe/router"
	"gin-sns/app/service/middleware/auth"
)

//加载路由
func init() {
	// 用户管理路由
	g1 := router.New("admin", "/system/user", auth.Auth)
	g1.GET("/", "system:user:view", UserController.List)
	g1.POST("/list", "system:user:list", UserController.ListAjax)
	g1.GET("/add", "system:user:add", UserController.Add)
	g1.POST("/add", "system:user:add", UserController.AddSave)
	g1.POST("/remove", "system:user:remove", UserController.Remove)
	g1.GET("/edit", "system:user:edit", UserController.Edit)
	g1.POST("/edit", "system:user:edit", UserController.EditSave)
	g1.POST("/export", "system:user:export", UserController.Export)
	g1.GET("/resetPwd", "system:user:resetPwd", UserController.ResetPwd)
	g1.POST("/resetPwd", "system:user:resetPwd", UserController.ResetPwdSave)

	// 个人中心路由
	g2 := router.New("admin", "/system/user/profile", auth.Auth)
	g2.GET("/", "", ProfileController.Profile)
	g2.GET("/avatar", "", ProfileController.Avatar)
	g2.GET("/resetPwd", "", ProfileController.EditPwd)
	g2.POST("/update", "", ProfileController.Update)
	g2.POST("/resetSavePwd", "", ProfileController.UpdatePassword)
	g2.POST("/checkEmailUnique", "", ProfileController.CheckEmailUnique)
	g2.POST("/checkPhoneUnique", "", ProfileController.CheckPhoneUnique)
	g2.POST("/checkLoginNameUnique", "", ProfileController.CheckLoginNameUnique)
	g2.POST("/checkEmailUniqueAll", "", ProfileController.CheckEmailUniqueAll)
	g2.POST("/checkPhoneUniqueAll", "", ProfileController.CheckPhoneUniqueAll)
	g2.POST("/checkPassword", "", ProfileController.CheckPassword)
	g2.POST("/updateAvatar", "", ProfileController.UpdateAvatar)
}
